﻿using System;
using System.Web.Security;
using System.Web.UI.WebControls;

namespace SBPweb.PhotoGallery.Host
{
    public partial class Login : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lLogin_LoggedIn(object sender, EventArgs e)
        {

        }

        protected void lLogin_Authenticate(object sender, AuthenticateEventArgs e)
        {
            //e.Authenticated = Membership.ValidateUser(lLogin.UserName);
            //if (!e.Authenticated)
            //{
            //    return;
            //}
            TextBox tbEmail = lLogin.FindControl("Email") as TextBox;
            MembershipUser mu = Membership.GetUser(lLogin.UserName);
            e.Authenticated = (mu != null) && (mu.IsApproved) && (mu.Email == tbEmail.Text);
        }

        protected void lLogin_LoggingIn(object sender, LoginCancelEventArgs e)
        {

        }

        protected void lLogin_LoginError(object sender, EventArgs e)
        {

        }

    }
}
